﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:kec="clr-namespace:KinectExtensions.Controls" xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing" xmlns:Converter="clr-namespace:KinectExtensions.Converter" xmlns:Helpers="clr-namespace:KinectExtensions.Helpers">

	<Style TargetType="{x:Type kec:KinectPreview}">
		<Style.Setters>
			<Setter Property="Width" Value="160" />
			<Setter Property="Height" Value="120" />
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type kec:KinectPreview}">
						<Grid>
							<Image Name="depth" />
						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style.Setters>
	</Style>

	<Style x:Key="HorizontalHandSliderThumbStyle" TargetType="{x:Type Thumb}">
		<Setter Property="Focusable" Value="false" />
		<Setter Property="OverridesDefaultStyle" Value="true" />
		<Setter Property="Height" Value="22" />
		<Setter Property="Width" Value="11" />
		<Setter Property="Foreground" Value="Gray" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Thumb}">
					<Canvas Height="54" Width="54" VerticalAlignment="Center" HorizontalAlignment="Center" Opacity="1">
						<Ellipse Width="54" Height="54" Stretch="Fill" StrokeThickness="2.72727" StrokeLineJoin="Round" Stroke="#FFFFFFFF" Fill="#FFE77F0F" />
						<Path Width="32" Height="35" Canvas.Left="10" Canvas.Top="9" Stretch="Fill" Fill="#FFFFFFFF" Data="F1 M 42.7119,19.7392C 43.021,18.3919 42.2855,17.0773 41.0781,16.8185C 39.8716,16.5597 38.5868,17.4381 38.2241,18.7721L 36.338,25.7017C 36.109,25.4946 35.8696,25.2986 35.6216,25.1131L 36.8721,13.6385C 37.0228,12.2645 36.1392,11.0476 34.9102,10.9339C 33.6805,10.8203 32.5187,11.8468 32.3282,13.2165L 30.9272,23.2766C 30.7911,23.2624 30.6515,23.2624 30.5138,23.2542L 29.7896,12.0358C 29.7001,10.657 28.621,9.60852 27.3911,9.70587C 26.1595,9.80402 25.1656,11.0149 25.1813,12.3975L 25.3156,24.4263C 25.1934,24.4934 25.078,24.5696 24.96,24.6424L 23.0223,14.9501C 22.751,13.595 21.5419,12.6994 20.3345,12.9603C 19.1279,13.2204 18.3029,14.5531 18.501,15.9207L 20.6385,30.6605C 20.6246,30.7225 20.604,30.7819 20.5909,30.8447L 14.6031,25.6328C 13.3009,24.5004 11.5304,24.4216 10.6675,25.4579C 9.80627,26.4953 10.0526,28.3865 11.2159,29.6614L 22.5812,42.1088L 22.583,42.0975C 24.3105,43.8173 26.6884,44.8818 29.3159,44.8818C 33.7476,44.8818 37.4637,41.8521 38.5419,37.7507L 38.5712,37.8152L 39.1,35.5081C 39.2017,35.1619 39.2799,34.8072 39.3428,34.4467L 42.7119,19.7392 Z " />
					</Canvas>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style x:Key="LeftHandSliderStyle" TargetType="{x:Type Slider}">
		<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false" />
		<Setter Property="Background" Value="Transparent" />
		<Setter Property="Foreground" Value="#FFC4C4C4" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Slider}">
					<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
						<Grid>
							<Grid.RowDefinitions>
								<RowDefinition Height="Auto" />
								<RowDefinition Height="Auto" MinHeight="{TemplateBinding MinHeight}" />
								<RowDefinition Height="Auto" />
							</Grid.RowDefinitions>
							<Track x:Name="PART_Track" Grid.Row="1">
								<Track.DecreaseRepeatButton>
									<RepeatButton Visibility="Hidden" />
								</Track.DecreaseRepeatButton>
								<Track.IncreaseRepeatButton>
									<RepeatButton Visibility="Hidden" />
								</Track.IncreaseRepeatButton>
								<Track.Thumb>
									<Thumb x:Name="Thumb" Style="{StaticResource HorizontalHandSliderThumbStyle}" Width="54" Height="54" />
								</Track.Thumb>
							</Track>
						</Grid>
					</Border>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style x:Key="RightHandSliderStyle" TargetType="{x:Type Slider}">
		<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false" />
		<Setter Property="Background" Value="Transparent" />
		<Setter Property="Foreground" Value="#FFC4C4C4" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Slider}">
					<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
						<Grid>
							<Grid.RowDefinitions>
								<RowDefinition Height="Auto" />
								<RowDefinition Height="Auto" MinHeight="{TemplateBinding MinHeight}" />
								<RowDefinition Height="Auto" />
							</Grid.RowDefinitions>
							<Track x:Name="PART_Track" Grid.Row="1">
								<Track.DecreaseRepeatButton>
									<RepeatButton Visibility="Hidden" />
								</Track.DecreaseRepeatButton>
								<Track.IncreaseRepeatButton>
									<RepeatButton Visibility="Hidden" />
								</Track.IncreaseRepeatButton>
								<Track.Thumb>
									<Thumb x:Name="Thumb" Style="{StaticResource HorizontalHandSliderThumbStyle}" Width="54" Height="54" RenderTransformOrigin="0.5,0.5">
										<Thumb.RenderTransform>
											<ScaleTransform ScaleX="-1" />
										</Thumb.RenderTransform>
									</Thumb>
								</Track.Thumb>
							</Track>
						</Grid>
					</Border>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style TargetType="kec:SlidingButton">
		<Style.Setters>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type kec:SlidingButton}">
						<Grid Height="90" Width="90" Background="Transparent" x:Name="root">
							<VisualStateManager.VisualStateGroups>
								<VisualStateGroup x:Name="KinectStates">
									<VisualState x:Name="OpenedState">
										<Storyboard>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="rectangle">
												<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1" />
											</DoubleAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="gridLeft">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
											</ObjectAnimationUsingKeyFrames>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Width)" Storyboard.TargetName="rectangle">
												<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="270" />
											</DoubleAnimationUsingKeyFrames>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="path">
												<EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="0" />
												<EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="1" />
												<EasingDoubleKeyFrame KeyTime="0:0:0.8" Value="0" />
												<EasingDoubleKeyFrame KeyTime="0:0:1.2" Value="0" />
												<EasingDoubleKeyFrame KeyTime="0:0:1.4" Value="1" />
												<EasingDoubleKeyFrame KeyTime="0:0:1.6" Value="0" />
											</DoubleAnimationUsingKeyFrames>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="path1">
												<EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="0" />
												<EasingDoubleKeyFrame KeyTime="0:0:0.8" Value="1" />
												<EasingDoubleKeyFrame KeyTime="0:0:1" Value="0" />
												<EasingDoubleKeyFrame KeyTime="0:0:1.4" Value="0" />
												<EasingDoubleKeyFrame KeyTime="0:0:1.6" Value="1" />
												<EasingDoubleKeyFrame KeyTime="0:0:1.8" Value="0" />
											</DoubleAnimationUsingKeyFrames>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="path2">
												<EasingDoubleKeyFrame KeyTime="0:0:0.7" Value="0" />
												<EasingDoubleKeyFrame KeyTime="0:0:0.9" Value="1" />
												<EasingDoubleKeyFrame KeyTime="0:0:1.1" Value="0" />
												<EasingDoubleKeyFrame KeyTime="0:0:1.5" Value="0" />
												<EasingDoubleKeyFrame KeyTime="0:0:1.7" Value="1" />
												<EasingDoubleKeyFrame KeyTime="0:0:1.9" Value="0" />
											</DoubleAnimationUsingKeyFrames>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="path3">
												<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0" />
												<EasingDoubleKeyFrame KeyTime="0:0:0.7" Value="1" />
												<EasingDoubleKeyFrame KeyTime="0:0:0.9" Value="0" />
												<EasingDoubleKeyFrame KeyTime="0:0:1.3" Value="0" />
												<EasingDoubleKeyFrame KeyTime="0:0:1.5" Value="1" />
												<EasingDoubleKeyFrame KeyTime="0:0:1.7" Value="0" />
											</DoubleAnimationUsingKeyFrames>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="canvas">
												<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0" />
											</DoubleAnimationUsingKeyFrames>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="slider1">
												<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1" />
											</DoubleAnimationUsingKeyFrames>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="slider2">
												<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1" />
											</DoubleAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
									<VisualState x:Name="ClosedState">
										<Storyboard>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="gridLeft">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Collapsed}" />
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
								</VisualStateGroup>
								<VisualStateGroup x:Name="SideStates">
									<VisualState x:Name="OpenToTheLeftRightHand">
										<Storyboard>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="slider1">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Collapsed}" />
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="slider2">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
											</ObjectAnimationUsingKeyFrames>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="canvas">
												<EasingDoubleKeyFrame KeyTime="0" Value="-1" />
											</DoubleAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
									<VisualState x:Name="OpenToTheLeftLeftHand">
										<Storyboard>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="slider2">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Collapsed}" />
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="slider1">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
											</ObjectAnimationUsingKeyFrames>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="canvas">
												<EasingDoubleKeyFrame KeyTime="0" Value="-1" />
											</DoubleAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
									<VisualState x:Name="OpenToTheRightRightHand">
										<Storyboard>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="gridLeft">
												<EasingDoubleKeyFrame KeyTime="0" Value="-1" />
											</DoubleAnimationUsingKeyFrames>
											<ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="gridLeft">
												<EasingThicknessKeyFrame KeyTime="0" Value="0,-30,-220,-30" />
											</ThicknessAnimationUsingKeyFrames>

											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="slider2">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Collapsed}" />
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="slider1">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
									<VisualState x:Name="OpenToTheRightLeftHand">
										<Storyboard>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="gridLeft">
												<EasingDoubleKeyFrame KeyTime="0" Value="-1" />
											</DoubleAnimationUsingKeyFrames>
											<ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="gridLeft">
												<EasingThicknessKeyFrame KeyTime="0" Value="0,-30,-220,-30" />
											</ThicknessAnimationUsingKeyFrames>

											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="slider1">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Collapsed}" />
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="slider2">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
								</VisualStateGroup>
							</VisualStateManager.VisualStateGroups>
							<Canvas x:Name="canvas" Height="54" Width="54" VerticalAlignment="Center" HorizontalAlignment="Center" RenderTransformOrigin="0.5,0.5">
								<Canvas.RenderTransform>
									<TransformGroup>
										<ScaleTransform />
										<SkewTransform />
										<RotateTransform />
										<TranslateTransform />
									</TransformGroup>
								</Canvas.RenderTransform>
								<Ellipse Width="54" Height="54" Stretch="Fill" StrokeThickness="4" StrokeLineJoin="Round" Stroke="#FFFFFFFF" />
								<Path Width="23.188" Height="27.292" Canvas.Left="13.705" Canvas.Top="12.646" Stretch="Fill" Fill="#FFFFFFFF" Data="F1 M 28.2002,12.6456L 13.7048,26.3231L 28.1372,39.9376L 36.8295,39.9376L 22.397,26.3231L 36.8926,12.6456L 28.2002,12.6456 Z "></Path>
							</Canvas>
							<Grid x:Name="gridLeft" Background="Transparent" Margin="-220,-90,0,-90" Visibility="{x:Static Visibility.Collapsed}" RenderTransformOrigin="0.5,0.5">
								<Grid.RenderTransform>
									<TransformGroup>
										<ScaleTransform />
										<SkewTransform />
										<RotateTransform />
										<TranslateTransform />
									</TransformGroup>
								</Grid.RenderTransform>
								<Rectangle x:Name="rectangle" Fill="#52FFFFFF" HorizontalAlignment="Right" RadiusY="24" RadiusX="24" Stroke="#FFFFFFFF" StrokeThickness="4" StrokeLineJoin="Round" Width="54" VerticalAlignment="Center" Height="54" Margin="0,0,18,0" Opacity="0" />
								<Canvas HorizontalAlignment="Left" Height="27.292" VerticalAlignment="Center" Width="143.384" Margin="40,0,0,0">
									<Path x:Name="path1" Width="23.1879" Height="27.2921" Canvas.Left="40.0653" Canvas.Top="0.000244141" Stretch="Fill" Fill="#FFFFFFFF" Data="F1 M 54.5609,0.000244141L 40.0653,13.6778L 54.4978,27.2923L 63.1902,27.2923L 48.7576,13.6778L 63.2532,0.000244141L 54.5609,0.000244141 Z " Opacity="0" />
									<Path x:Name="path2" Width="23.1879" Height="27.2921" Canvas.Left="0" Canvas.Top="0.000244141" Stretch="Fill" Fill="#FFFFFFFF" Data="F1 M 14.4955,0.000244141L 0,13.6778L 14.4325,27.2923L 23.1248,27.2923L 8.69226,13.6778L 23.1879,0.000244141L 14.4955,0.000244141 Z " Opacity="0" />
									<Path x:Name="path3" Width="23.1879" Height="27.292" Canvas.Left="80.1309" Canvas.Top="0.000183105" Stretch="Fill" Fill="#FFFFFFFF" Data="F1 M 94.6263,0.000183105L 80.1309,13.6777L 94.5634,27.2922L 103.256,27.2922L 88.8231,13.6777L 103.319,0.000183105L 94.6263,0.000183105 Z " Opacity="0" />
									<Path x:Name="path" Width="23.1879" Height="27.2921" Canvas.Left="120.196" Canvas.Top="0" Stretch="Fill" Fill="#FFFFFFFF" Data="F1 M 134.692,0L 120.196,13.6776L 134.629,27.2921L 143.321,27.2921L 128.889,13.6776L 143.384,0L 134.692,0 Z " Opacity="0" />
								</Canvas>
								<Slider x:Name="slider2" HorizontalAlignment="Right" VerticalAlignment="Center" Style="{StaticResource RightHandSliderStyle}" Height="Auto" Margin="0,0,18,0" Width="270" RenderTransformOrigin="0.5,0.5" Value="{Binding SlidingPosition, RelativeSource={RelativeSource Mode=TemplatedParent}}" Maximum="1" Opacity="0">
									<Slider.RenderTransform>
										<TransformGroup>
											<ScaleTransform ScaleX="-1" />
											<SkewTransform />
											<RotateTransform />
											<TranslateTransform />
										</TransformGroup>
									</Slider.RenderTransform>
								</Slider>
								<Slider x:Name="slider1" HorizontalAlignment="Right" VerticalAlignment="Center" Style="{StaticResource LeftHandSliderStyle}" Height="Auto" Margin="0,0,18,0" Width="270" RenderTransformOrigin="0.5,0.5" Value="{Binding SlidingPosition, RelativeSource={RelativeSource Mode=TemplatedParent}}" Maximum="1" Opacity="0">
									<Slider.RenderTransform>
										<TransformGroup>
											<ScaleTransform ScaleX="-1" />
											<SkewTransform />
											<RotateTransform />
											<TranslateTransform />
										</TransformGroup>
									</Slider.RenderTransform>
								</Slider>
							</Grid>
						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style.Setters>
	</Style>

	<Style TargetType="kec:KinectCursor">
		<Style.Setters>
			<Setter Property="KinectZone" Value="{Binding KinectZone}" />

			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type kec:KinectCursor}">
						<Grid Width="60" Height="60" x:Name="root" RenderTransformOrigin="0.5,0.5">
							<Grid.RenderTransform>
								<TransformGroup>
									<ScaleTransform />
									<TranslateTransform X="-30" Y="-30" />
								</TransformGroup>
							</Grid.RenderTransform>
							<VisualStateManager.VisualStateGroups>
								<VisualStateGroup x:Name="HoveringStates">
									<VisualState x:Name="HoveringState">
										<Storyboard>
											<DoubleAnimation Duration="0:0:10" From="0" To="360" Storyboard.TargetProperty="(ed:Arc.EndAngle)" Storyboard.TargetName="arc" />
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="arc">
												<DiscreteObjectKeyFrame KeyTime="0">
													<DiscreteObjectKeyFrame.Value>
														<Visibility>Visible</Visibility>
													</DiscreteObjectKeyFrame.Value>
												</DiscreteObjectKeyFrame>
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="ellipse">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
											</ObjectAnimationUsingKeyFrames>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="ellipse">
												<EasingDoubleKeyFrame KeyTime="0" Value="0" />
												<EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="1" />
											</DoubleAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
									<VisualState x:Name="IdleState" />
								</VisualStateGroup>
								<VisualStateGroup x:Name="HandTypeStates">
									<VisualState x:Name="HandLeftState">
										<Storyboard>
											<DoubleAnimation Duration="0" To="-1" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)" Storyboard.TargetName="hand" />
										</Storyboard>
									</VisualState>
									<VisualState x:Name="HandRightState" />
								</VisualStateGroup>
								<VisualStateGroup x:Name="SelectionState">
									<VisualState x:Name="ActiveState" />
									<VisualState x:Name="NotActiveState">
										<Storyboard>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="root">
												<EasingDoubleKeyFrame KeyTime="0" Value="0.5" />
											</DoubleAnimationUsingKeyFrames>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="root">
												<EasingDoubleKeyFrame KeyTime="0" Value="0.5" />
											</DoubleAnimationUsingKeyFrames>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="root">
												<EasingDoubleKeyFrame KeyTime="0" Value="0.5" />
											</DoubleAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
								</VisualStateGroup>
							</VisualStateManager.VisualStateGroups>

							<Ellipse x:Name="ellipse" Height="100" StrokeThickness="10" Width="100" Stroke="#22000000" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="-20" Visibility="{x:Static Visibility.Collapsed}" Opacity="0" />
							<ed:Arc x:Name="arc" ArcThickness="10" ArcThicknessUnit="Pixel" EndAngle="0" Fill="White" Height="100" Stretch="None" StartAngle="0" Visibility="{x:Static Visibility.Collapsed}" Width="100" StrokeThickness="0" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="-20" />
							<Image x:Name="hand" Height="60" RenderTransformOrigin="0.5,0.5" Source="/KinectExtensions;component/Assets/Hand.png" CacheMode="BitmapCache" Width="60">
								<Image.RenderTransform>
									<ScaleTransform />
								</Image.RenderTransform>
							</Image>
						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style.Setters>
	</Style>

	<Style TargetType="{x:Type kec:KinectInteractionLayer}">
		<Style.Setters>
			<Setter Property="ClipToBounds" Value="True" />
			<Setter Property="HorizontalContentAlignment" Value="Stretch" />
			<Setter Property="VerticalContentAlignment" Value="Stretch" />
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type kec:KinectInteractionLayer}">
						<Grid x:Name="root">
							<VisualStateManager.VisualStateGroups>
								<VisualStateGroup x:Name="InteracionStates">
									<VisualState x:Name="MouseState">
										<Storyboard>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="ItemsControl">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Collapsed}" />
											</ObjectAnimationUsingKeyFrames>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="voicePanel">
												<EasingDoubleKeyFrame KeyTime="0:0:0.300" Value="0">
													<EasingDoubleKeyFrame.EasingFunction>
														<SineEase />
													</EasingDoubleKeyFrame.EasingFunction>
												</EasingDoubleKeyFrame>
											</DoubleAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="voicePanel">
												<DiscreteObjectKeyFrame KeyTime="0:0:0.300" Value="{x:Static Visibility.Collapsed}" />
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
									<VisualState x:Name="KinectState">
										<Storyboard>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="voicePanel">
												<EasingDoubleKeyFrame KeyTime="0:0:0.300" Value="0">
													<EasingDoubleKeyFrame.EasingFunction>
														<SineEase />
													</EasingDoubleKeyFrame.EasingFunction>
												</EasingDoubleKeyFrame>
											</DoubleAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="kinectPanel">
												<DiscreteObjectKeyFrame KeyTime="0:0:0.1" Value="{x:Static Visibility.Collapsed}" />
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="ItemsControl">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Cursor)" Storyboard.TargetName="root">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Cursors.None}" />
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="voicePanel">
												<DiscreteObjectKeyFrame KeyTime="0:0:0.300" Value="{x:Static Visibility.Collapsed}" />
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
									<VisualState x:Name="VoiceState">
										<Storyboard>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="voicePanel">
												<EasingDoubleKeyFrame KeyTime="0" Value="0" />
												<EasingDoubleKeyFrame KeyTime="0:0:0.300" Value="150">
													<EasingDoubleKeyFrame.EasingFunction>
														<SineEase />
													</EasingDoubleKeyFrame.EasingFunction>
												</EasingDoubleKeyFrame>
											</DoubleAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="ItemsControl">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Collapsed}" />
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="kinectPanel">
												<DiscreteObjectKeyFrame KeyTime="0:0:0.1" Value="{x:Static Visibility.Collapsed}" />
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
								</VisualStateGroup>
							</VisualStateManager.VisualStateGroups>


							<Canvas x:Name="overlay" />

							<ItemsControl ItemsSource="{Binding HandPositions, RelativeSource={RelativeSource Mode=TemplatedParent}}" x:Name="ItemsControl" VerticalAlignment="Top" HorizontalAlignment="Left">
								<ItemsControl.ItemsPanel>
									<ItemsPanelTemplate>
										<Canvas IsItemsHost="True" />
									</ItemsPanelTemplate>
								</ItemsControl.ItemsPanel>
								<ItemsControl.ItemTemplate>
									<DataTemplate>
										<kec:KinectCursor IsActive="{Binding IsMaster}" Position="{Binding Point}" JointId="{Binding JointId}" />
									</DataTemplate>
								</ItemsControl.ItemTemplate>
							</ItemsControl>

							<StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="50" Name="kinectPanel">
								<kec:Hello Margin="30,0" VerticalAlignment="Center" />
								<kec:KinectPreview VerticalAlignment="Center" />
							</StackPanel>

							<Grid x:Name="voicePanel" Height="0" VerticalAlignment="Bottom" Width="Auto">
								<Grid HorizontalAlignment="Stretch" Height="150" VerticalAlignment="Top" Width="Auto" Background="Black" Margin="0,0,0,-170">
									<Path Stretch="Fill" Fill="White" Data="F1 M 292.25,1105.17C 288.083,1105.17 284.705,1108.55 284.705,1112.71C 284.705,1116.88 288.083,1120.26 292.25,1120.26L 302.995,1120.26L 302.995,1126.43L 292.25,1126.43C 288.083,1126.43 284.705,1129.81 284.705,1133.98C 284.705,1138.14 288.083,1141.52 292.25,1141.52L 302.995,1141.52L 302.995,1147.69L 292.25,1147.69C 288.083,1147.69 284.705,1151.07 284.705,1155.24C 284.705,1159.41 288.083,1162.78 292.25,1162.78L 302.995,1162.78L 302.995,1167.81C 302.995,1178.17 294.601,1186.56 284.247,1186.56L 278.703,1186.56L 278.71,1201.6C 281.845,1220.9 293.126,1235.59 306.959,1237.52L 306.959,1240.92L 278.023,1240.92L 275.84,1240.92L 246.904,1240.92L 246.904,1237.52C 260.737,1235.59 272.017,1220.9 275.152,1201.6L 275.157,1201.6L 275.157,1186.56L 269.616,1186.56C 259.262,1186.56 250.868,1178.17 250.868,1167.81L 250.868,1162.55L 261.476,1162.55C 265.642,1162.55 269.02,1159.18 269.02,1155.01C 269.02,1150.84 265.642,1147.47 261.476,1147.47L 250.868,1147.47L 250.868,1141.29L 261.476,1141.29C 265.642,1141.29 269.02,1137.91 269.02,1133.75C 269.02,1129.58 265.642,1126.2 261.476,1126.2L 250.868,1126.2L 250.868,1120.03L 261.475,1120.03C 265.642,1120.03 269.02,1116.65 269.02,1112.49C 269.02,1108.32 265.642,1104.94 261.475,1104.94L 251.102,1104.94C 252.526,1096 260.273,1089.17 269.616,1089.17L 284.247,1089.17C 293.669,1089.17 301.468,1096.12 302.796,1105.17L 292.25,1105.17 Z " HorizontalAlignment="Left" Height="75.945" VerticalAlignment="Center" Width="30.055" Margin="30,0,0,0" />
									<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="Listening" VerticalAlignment="Top" Foreground="White" FontSize="26.667" Margin="100,20,0,0" />
                                    <ItemsControl ItemsSource="{TemplateBinding BarVoiceCommands}"
                                                  VerticalAlignment="Top"
                                                  Margin="100,70,0,0"
                                                  >
                                        <ItemsControl.ItemsPanel>
                                            <ItemsPanelTemplate>
                                                <StackPanel Orientation="Horizontal" />
                                            </ItemsPanelTemplate>
                                        </ItemsControl.ItemsPanel>
                                        <ItemsControl.ItemTemplate>
                                            <DataTemplate>
                                                <TextBlock Text="{Binding }"
                                                           Margin="0,0,20,0"
                                                           Foreground="White"
                                                           FontSize="26.667"
                                                            />
                                            </DataTemplate>
                                        </ItemsControl.ItemTemplate>
                                    </ItemsControl>
                                    
                                </Grid>
							</Grid>
						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style.Setters>
	</Style>

	<Style TargetType="{x:Type kec:Hello}">
		<Setter Property="Width" Value="54" />
		<Setter Property="Height" Value="60" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type kec:Hello}">
					<Grid x:Name="root" Background="{TemplateBinding Background}">
						<VisualStateManager.VisualStateGroups>
							<VisualStateGroup x:Name="ActiveHandStates">
								<VisualState x:Name="HandReadyState">
									<Storyboard>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="root">
											<DiscreteObjectKeyFrame KeyTime="0">
												<DiscreteObjectKeyFrame.Value>
													<Visibility>Visible</Visibility>
												</DiscreteObjectKeyFrame.Value>
											</DiscreteObjectKeyFrame>
										</ObjectAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>
								<VisualState x:Name="NoHandState">
									<Storyboard>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="root">
											<DiscreteObjectKeyFrame KeyTime="0">
												<DiscreteObjectKeyFrame.Value>
													<Visibility>Collapsed</Visibility>
												</DiscreteObjectKeyFrame.Value>
											</DiscreteObjectKeyFrame>
										</ObjectAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>
							</VisualStateGroup>
							<VisualStateGroup x:Name="RecognitionState">
								<VisualState x:Name="DetectRightToLeft">
									<Storyboard>
										<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="rectangle">
											<EasingDoubleKeyFrame KeyTime="0" Value="90" />
											<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0" />
										</DoubleAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>
								<VisualState x:Name="NoDetection">
									<Storyboard>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="rectangle">
											<DiscreteObjectKeyFrame KeyTime="0">
												<DiscreteObjectKeyFrame.Value>
													<Visibility>Collapsed</Visibility>
												</DiscreteObjectKeyFrame.Value>
											</DiscreteObjectKeyFrame>
										</ObjectAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>
								<VisualState x:Name="DetectLeftToRight">
									<Storyboard>
										<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="rectangle">
											<EasingDoubleKeyFrame KeyTime="0" Value="0" />
											<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="90" />
										</DoubleAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>
							</VisualStateGroup>
						</VisualStateManager.VisualStateGroups>
						<Canvas VerticalAlignment="Center" Width="54" HorizontalAlignment="Center" Height="60">
							<Grid Background="White" Clip="M24.858998,34.444007L27.714698,23.805122 30.136395,26.134074C35.0957,20.861966 42.224128,17.556003 50.145558,17.556003 57.936847,17.556003 64.960627,20.754019 69.908075,25.875462L72.285304,23.589227 75.141003,34.228112 64.250038,31.316417 66.176367,29.463993C62.168072,25.309748 56.474164,22.715257 50.158009,22.715257 43.704893,22.715257 37.901892,25.423179 33.881739,29.735593L35.749964,31.532312z" Width="100" Height="100" HorizontalAlignment="Center" VerticalAlignment="Center" Canvas.Left="-23" Canvas.Top="-13.5">
								<Rectangle x:Name="rectangle" Margin="0" RenderTransformOrigin="0.5,0.5" StrokeLineJoin="Round">
									<Rectangle.Fill>
										<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
											<LinearGradientBrush.RelativeTransform>
												<TransformGroup>
													<ScaleTransform CenterY="0.5" CenterX="0.5" />
													<SkewTransform CenterY="0.5" CenterX="0.5" />
													<RotateTransform Angle="45" CenterY="0.5" CenterX="0.5" />
													<TranslateTransform />
												</TransformGroup>
											</LinearGradientBrush.RelativeTransform>
											<GradientStop Color="#FFCD9FE4" Offset="0.5" />
											<GradientStop Color="White" Offset="0.651" />
											<GradientStop Color="White" Offset="0.349" />
											<GradientStop Color="#FFD9B7E8" Offset="0.444" />
											<GradientStop Color="#FED5B1E6" Offset="0.547" />
										</LinearGradientBrush>
									</Rectangle.Fill>
									<Rectangle.RenderTransform>
										<TransformGroup>
											<ScaleTransform />
											<SkewTransform />
											<RotateTransform />
											<TranslateTransform />
										</TransformGroup>
									</Rectangle.RenderTransform>
								</Rectangle>
							</Grid>
							<Path Data="F1M31.9921,14.9753C32.2211,13.9773 31.6763,13.0035 30.782,12.8118 29.8882,12.6201 28.9364,13.2708 28.6678,14.2589L27.2708,19.392C27.1011,19.2386,26.9237,19.0934,26.74,18.9559L27.6663,10.4562C27.7778,9.43848 27.1234,8.53705 26.2131,8.45282 25.3021,8.36865 24.4414,9.12909 24.3005,10.1436L23.2626,17.5956C23.1619,17.5851,23.0585,17.5851,22.9564,17.579L22.4199,9.2691C22.3535,8.24774 21.5542,7.47107 20.6433,7.54315 19.731,7.61591 18.9949,8.51282 19.0063,9.53699L19.1058,18.4472C19.0154,18.4969,18.9299,18.5534,18.8425,18.6073L17.4071,11.4278C17.2061,10.424 16.3105,9.76062 15.4163,9.95392 14.5223,10.1465 13.9114,11.1337 14.058,12.1468L15.6414,23.0651C15.6311,23.1111,15.6157,23.1551,15.6063,23.2016L11.1708,19.3409C10.2063,18.5021 8.89453,18.4437 8.25537,19.2114 7.61755,19.9798 7.80005,21.3807 8.66187,22.3251L17.0804,31.5453 17.0818,31.537C18.3613,32.811 20.1228,33.5995 22.0691,33.5995 25.3519,33.5995 28.1045,31.3553 28.9032,28.3171L28.9248,28.365 29.3167,26.656C29.3918,26.3996,29.45,26.1368,29.4965,25.8698L31.9921,14.9753z" Fill="White" HorizontalAlignment="Center" Height="41.156" Margin="-4,0,0,0" Stretch="Fill" VerticalAlignment="Center" Width="38.168" Canvas.Left="10" Canvas.Top="16" />
						</Canvas>
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style TargetType="{x:Type kec:HandTracking}">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type kec:HandTracking}">
					<Grid>
						<Slider VerticalAlignment="Top" Orientation="Horizontal" Value="{Binding RelativePosition.X, RelativeSource={RelativeSource Mode=TemplatedParent}}" Minimum="0" Maximum="1" />
						<Slider HorizontalAlignment="Left" Orientation="Vertical" Value="{Binding RelativePosition.Y, RelativeSource={RelativeSource Mode=TemplatedParent}}" Minimum="0" Maximum="1" RenderTransformOrigin="0.5,0.5">
							<Slider.RenderTransform>
								<ScaleTransform ScaleY="-1" />
							</Slider.RenderTransform>
						</Slider>
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
</ResourceDictionary>